//package com.coke.spring.seata.service.impl;
//
//import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
//import com.coke.spring.seata.entity.Order;
//import com.coke.spring.seata.fegin.StockClient;
//import com.coke.spring.seata.mapper.OrderMapper;
//import com.coke.spring.seata.service.OrderService;
//import io.seata.spring.annotation.GlobalTransactional;
//import lombok.AllArgsConstructor;
//import org.springframework.stereotype.Service;
//
///**
// * @author cwm
// * @Description TODO
// * @date 2021/9/2 下午4:11
// * @Version 1.0
// */
//@Service
//@AllArgsConstructor
//public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements OrderService {
//    private final StockClient stockClient;
//    @GlobalTransactional
//    public void insert(Order order) {
//        //创建订单
//        this.baseMapper.insert(order);
//        //模拟异常
//        int a =15;
//        int b =0;
//        int i = a / b;
//        //扣减库存
//        stockClient.stock(order.getProductId());
//    }
//}
